from abc import ABCMeta, abstractmethod


class Text(object):
    __slots__ = ('_name', '_age', '_six')

    def __init__(self, name, age):
        self._name = name
        self._age = age

    @property
    def name(self):
        return self._name

    @property
    def age(self):
        return self._age

    @age.setter
    def age(self, age):
        self._age = age if age > 18 else 0

    @property
    def alive(self):
        return self._age > 18

    @abstractmethod
    def attack(self, office):
        #   这是个抽象方法

        pass


class Use(Text):
    __slots__ = ('_name', '_age', '_six')

    def __init__(self, name, age, six):
        self._six = six
        super().__init__(name, age)

    def attack(self, office):
        office.six -= 1

    def huge_attack(self, office):
        if self.age >= 18:
            print('已经成年')
            injury = office.six * 2 - (office - 10)
            injury = injury if injury > 18 else 1024
            return True
        else:
            self.attack(office)
            return False

u = Use('as', 18, 0)
u.attack(1)
# print('%s' % u.alive)
